#!/bin/sh
. $HOME/.config/defaultprograms.txt
case "$1" in
 -default)
 echo $VIDEOPLAYER > $HOME/.config/tmp/player
 
 programchooser $VIDEOPLAYER multimedia-player "Player" None > $HOME/.config/tmp/videoplayer
 cat $HOME/.config/defaultprograms.txt | grep -v VIDEOPLAYER > $HOME/.config/defaultprograms.new
 VIDEOPLAYER="`cat $HOME/.config/tmp/videoplayer`"
 [ "$VIDEOPLAYER" = "" ] && VIDEOPLAYER="cat $HOME/.config/tmp/player"
 echo VIDEOPLAYER=\"$VIDEOPLAYER\" >> $HOME/.config/defaultprograms.new
 mv -f $HOME/.config/defaultprograms.new $HOME/.config/defaultprograms.txt
 rm -f $HOME/.config/tmp/player
 rm -f $HOME/.config/tmp/videoplayer
 ;;
 *)
 exec $VIDEOPLAYER "$@"
 ;;
esac
